package ie.timalb.chess.main.core.movement;

import ie.timalb.chess.main.core.movement.types.directions.Direction;
import ie.timalb.chess.main.core.movement.types.orientations.XOrientation;
import ie.timalb.chess.main.core.movement.types.orientations.YOrientation;
import ie.timalb.chess.main.core.temp.SquareIterator;

public class MovementDescriptor {
	Direction direction;
	XOrientation xOrientation;
	YOrientation yOrientation;
	
	public MovementDescriptor(Direction direction, XOrientation xOrientation, YOrientation yOrientation) {
		setDirection(direction);
		setXOrientation(xOrientation);
		setYOrientation(yOrientation);
	}
	
	public int getIncrementXInEachStep(){
		if (getXOrientation() == null)
		{
			return 0;
		}else
		{
			return xOrientation.getIncrementInEachStep();
		}
	}
	
	public int getIncrementYInEachStep(){
		if (getYOrientation() == null)
		{
			return 0;
		}else
		{
			return yOrientation.getIncrementInEachStep();
		}
	}
	
	public SquareIterator getIterator(){
		return null;
	}

	private void setDirection(Direction direction) {
		this.direction = direction;
	}

	private XOrientation getXOrientation() {
		return xOrientation;
	}

	private void setXOrientation(XOrientation orientation) {
		xOrientation = orientation;
	}

	private YOrientation getYOrientation() {
		return yOrientation;
	}
	
	private Direction getDirection() {
		return direction;
	}

	private void setYOrientation(YOrientation orientation) {
		yOrientation = orientation;
	}

	public MovementDescriptor getOpposite() {
		return new MovementDescriptor (getDirection(), getXOrientation().getOpposite(), getYOrientation().getOpposite());
	}

	public Location getNextLoopIterationLocation(Location currentLocation) {
		return getDirection().getNextLoopIterationLocation (currentLocation, getXOrientation(), getYOrientation());		 
	}
}
